package top.sjydzq.www.controller.Management;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import top.sjydzq.www.service.UserService;

@Controller
@RequestMapping("/management/user/")
public class MUserController {
    @Autowired
    private UserService userService;

    @RequestMapping("list")
    public String list(Model model) {
        model.addAttribute("users", userService.selectAll());

        return "Management/User/list";
    }

    @RequestMapping("remove")
    public String handleRemove(int id) {
        userService.remove(id);

        return "redirect:/management/user/list";
    }
}
